package com.resou.reader.data.signin;

import com.resou.reader.api.entry.Result;
import com.resou.reader.api.entry.ResultList;
import com.resou.reader.data.signin.model.BindingTask;
import com.resou.reader.data.signin.model.SignIn;
import com.resou.reader.data.signin.model.SignInInfo;
import com.resou.reader.data.signin.model.SignInInfo2;
import com.resou.reader.data.signin.model.SignStatus;

import io.reactivex.Completable;
import io.reactivex.Observable;

public class SignInRepository {
    private static final String TAG = "SignInRepository";
    private static SignInRepository sInstance;
    private SignInService mService;

    private SignInRepository(SignInService signInService) {
        mService = signInService;
    }

    public static SignInRepository getInstance(SignInService signInService) {
        if (sInstance == null) {
            sInstance = new SignInRepository(signInService);
        }
        return sInstance;
    }

    public Observable<Result<SignInInfo>> loadSignInfo(String token) {
        return mService.getSignInInfo(token);
    }

    public Observable<Result<SignInInfo2>> loadSignInfo2(String token) {
        return mService.getSignInInfo2(token);
    }

    public Observable<Result<SignIn>> signIn(String token, int weekDay) {
        return mService.signIn(token, weekDay);
    }

    public Observable<Result<SignStatus>> checkIsSignedIn(String token) {
        return mService.checkIsSignedIn(token);
    }

    public Observable<ResultList<BindingTask>> getVipTask(String token) {
        return mService.getVipTask(token);
    }

    public Observable<Result> receiveWelfare(String token, String taskId) {
        return mService.receiveWelfare(token, taskId);
    }
}
